import { createStore } from 'vuex'
interface SelAddrData {
	id : string
}
const selAddr = {} as SelAddrData
const commonStore = createStore({
	//存放状态
	state: {
		"reload": ['index', 'userIndex','carIndex'],
		"selAddr": selAddr,
		"payGoodsData":[]
	},
	mutations: {
		addReload(state, pageName : string) {
			const idx = state.reload.indexOf(pageName)
			if (idx < 0) state.reload.push(pageName)
		},
		delReload(state, pageName : string) {
			const idx = state.reload.indexOf(pageName)
			if (idx >= 0) state.reload.splice(idx, 1)
		},
		setSelAddr(state, data) {
			state.selAddr = data
		},
		reloadAll(state) {
			state.reload = ['index', 'userIndex','carIndex']
		},
		setPayGoodsData(state, data) {
			state.payGoodsData = data
		},
	},
	
})

export default commonStore